home *** CD-ROM | disk | FTP | other *** search
-
- {
- if(true)
- {
- CHUDPanelUnit = §§newclass(CHUDPanelUnit,Object);
- }
- }
-
- package Local.Game.HUD
- {
- import Local.*;
- import Local.Audio.*;
- import Local.Game.*;
- import Local.Game.Level.*;
- import Local.Game.Thing.*;
- import Local.Game.World.*;
- import Local.Game.World.Map.*;
- import Local.Game.World.Map.Cell.*;
- import STC9.IO.*;
- import STC9.System.*;
- import flash.display.*;
- import flash.events.*;
- import flash.filters.*;
- import flash.geom.*;
- import flash.text.*;
-
- public class CHUDPanelUnit
- {
-
- private static const mMaxSpeed:Number;
-
- private static const zPoint:Point;
-
- private static const mMaxArmor:Number = 300;
-
- {
- if(true)
- {
- zPoint = new Point();
- if(true)
- {
- mMaxSpeed = 30 * CThingSprite.mSpriteScalar;
- }
- mMaxArmor = 300;
- }
- }
-
- private var mHUD:CHUD;
-
- private var mcPanel:MovieClip;
-
- private var mButtons:Object;
-
- private var mSelectedThing:*;
-
- private var mcVisual:MovieClip;
-
- public function CHUDPanelUnit(param1:CHUD)
- {
- super();
- mHUD = param1;
- mcVisual = new Panel_Unit_VIS();
- }
-
- public function AddButton(param1:String, param2:MovieClip, param3:MovieClip, param4:Boolean = true) : void
- {
- param3.mcButton = param2;
- param3.mCommand = param1;
- if(mSelectedThing.mDead)
- {
- §§push(false);
- if(true)
- {
- param4 = §§pop();
- addr22:
- param3.mEnabled = param4;
- §§push(param4);
- }
- if(§§pop())
- {
- param3.alpha = 1;
- AddMouseEvents(param3);
- SetButtonVisual(param3,"mcOUT");
- }
- else
- {
- param3.alpha = 0.5;
- RemoveMouseEvents(param3);
- SetButtonVisual(param3,"mcDISABLED");
- }
- param3.enabled = param4;
- param2.enabled = false;
- mButtons[param1] = param3;
- return;
- }
- §§goto(addr22);
- }
-
- public function InitDraw(param1:CHUDPanel) : void
- {
- if(true)
- {
- param1.mDrawInit = true;
- if(true)
- {
- mcPanel = param1.mcPanel;
- if(true)
- {
- mSelectedThing = mHUD.mThingSelected;
- if(true)
- {
- mcPanel.tbName.text = mSelectedThing.mLongName;
- if(true)
- {
- mcPanel.tbText.text = mSelectedThing.mShortDesc;
- mcPanel.mcIcon.gotoAndStop(mSelectedThing.mIconIndex);
- }
- mcPanel.mcDeceased.visible = false;
- }
- SetupButtons();
- }
- mcPanel.mcBar_Speed.gotoAndStop(Math.round(mSelectedThing.mMaxSpeed * mcPanel.mcBar_Speed.totalFrames / mMaxSpeed) + 1);
- }
- mcPanel.mcBar_Armor.gotoAndStop(Math.round(mSelectedThing.mMaxLife * mcPanel.mcBar_Armor.totalFrames / mMaxArmor) + 1);
- }
- }
-
- private function RemoveMouseEvents(param1:MovieClip) : *
- {
- if(param1.hasEventListener(MouseEvent.MOUSE_OVER))
- {
- param1.removeEventListener(MouseEvent.MOUSE_OVER,e_MOUSE_OVER);
- }
- if(param1.hasEventListener(MouseEvent.MOUSE_OUT))
- {
- param1.removeEventListener(MouseEvent.MOUSE_OUT,e_MOUSE_OUT);
- }
- if(param1.hasEventListener(MouseEvent.MOUSE_DOWN))
- {
- param1.removeEventListener(MouseEvent.MOUSE_DOWN,e_MOUSE_DOWN);
- }
- if(param1.hasEventListener(MouseEvent.MOUSE_UP))
- {
- param1.removeEventListener(MouseEvent.MOUSE_UP,e_MOUSE_UP);
- }
- param1.buttonMode = false;
- param1.useHandCursor = false;
- }
-
- private function AddMouseEvents(param1:MovieClip) : *
- {
- param1.addEventListener(MouseEvent.MOUSE_OVER,e_MOUSE_OVER);
- param1.addEventListener(MouseEvent.MOUSE_OUT,e_MOUSE_OUT);
- param1.addEventListener(MouseEvent.MOUSE_DOWN,e_MOUSE_DOWN);
- param1.addEventListener(MouseEvent.MOUSE_UP,e_MOUSE_UP);
- param1.buttonMode = true;
- param1.useHandCursor = true;
- }
-
- public function e_DRAW(param1:Event = null) : void
- {
- var _loc2_:CHUDPanel = null;
- if(true)
- {
- CProfiler.StartProfile("PanelUnit.Draw");
- if(true)
- {
- if(mHUD.mThingSelected)
- {
- addr23:
- _loc2_ = CHUDPanel(param1.currentTarget);
- if(true)
- {
- §§push(_loc2_.mDrawInit);
- if(true)
- {
- if(!§§pop())
- {
- if(true)
- {
- InitDraw(_loc2_);
- if(true)
- {
- addr51:
- mcPanel.mcBar_Health.gotoAndStop(Math.max(1,Math.round(mSelectedThing.mLife * mcPanel.mcBar_Health.totalFrames / mSelectedThing.mMaxLife) + 1));
- if(true)
- {
- §§push(Boolean(mSelectedThing.mDead));
- if(true)
- {
- if(§§pop())
- {
- }
- addr83:
- if(§§pop())
- {
- mHUD.DeselectAll(true,true);
- addr95:
- CProfiler.StopProfile("PanelUnit.Draw");
- return;
- addr84:
- }
- §§goto(addr95);
- }
- §§pop();
- }
- §§goto(addr83);
- §§push(Boolean(mSelectedThing.mDisposed));
- }
- §§goto(addr84);
- }
- §§goto(addr95);
- }
- §§goto(addr51);
- }
- §§goto(addr83);
- }
- §§goto(addr95);
- }
- }
- return;
- }
- §§goto(addr23);
- }
-
- public function e_MOUSE_OUT(param1:MouseEvent = null) : void
- {
- SetButtonVisual(MovieClip(param1.currentTarget),"mcOUT");
- }
-
- public function SetupButtons() : void
- {
- if(true)
- {
- mButtons = new Object();
- if(true)
- {
- AddButton("proceed",mcPanel.mcIcon_Proceed,mcPanel.mcIcon_Proceed_BG,mSelectedThing.mCommandProceed);
- if(true)
- {
- AddButton("halt",mcPanel.mcIcon_Halt,mcPanel.mcIcon_Halt_BG,mSelectedThing.mCommandHalt);
- if(true)
- {
- AddButton("takecontrol",mcPanel.mcIcon_TakeControl,mcPanel.mcIcon_TakeControl_BG,mSelectedThing.mCommandTakeControl);
- if(true)
- {
- AddButton("drop",mcPanel.mcIcon_Drop,mcPanel.mcIcon_Drop_BG,mSelectedThing.mCommandDrop);
- new CHUDTooltip(mHUD,mcPanel.mcIcon_Proceed_BG,"Proceed: commands the unit to move to towards the objective (right-hand side of the map).");
- }
- new CHUDTooltip(mHUD,mcPanel.mcIcon_Halt,"Stand ground: commands the unit to stop and just hold this position.");
- }
- new CHUDTooltip(mHUD,mcPanel.mcIcon_TakeControl,"Take control: Not implemented in this version.");
- }
- new CHUDTooltip(mHUD,mcPanel.mcIcon_Drop,"Drop load: commands the unit to stop and drop it\'s load, either troops or tank.");
- }
- SelectButton(mButtons[mSelectedThing.mCommand]);
- }
- }
-
- private function SelectButton(param1:MovieClip) : *
- {
- var _loc2_:MovieClip = null;
- for each(_loc2_ in mButtons)
- {
- if(true)
- {
- if(_loc2_ != param1)
- {
- DeselectButton(_loc2_);
- }
- }
- }
- if(true)
- {
- SetButtonVisual(param1,"mcSELECTED");
- if(true)
- {
- RemoveMouseEvents(param1);
- }
- mSelectedThing.mCommand = param1.mCommand;
- }
- }
-
- public function e_MOUSE_UP(param1:MouseEvent = null) : void
- {
- CAudio.PlayGlobalSound(Click);
- SelectButton(MovieClip(param1.currentTarget));
- }
-
- private function SetButtonVisual(param1:MovieClip, param2:String) : void
- {
- param1.mcButton.transform.colorTransform = mcVisual[param2].transform.colorTransform;
- param1.mcButton.filters = mcVisual[param2].filters;
- }
-
- public function e_MOUSE_DOWN(param1:MouseEvent = null) : void
- {
- SetButtonVisual(MovieClip(param1.currentTarget),"mcDOWN");
- }
-
- public function e_MOUSE_OVER(param1:MouseEvent = null) : void
- {
- if(true)
- {
- SetButtonVisual(MovieClip(param1.currentTarget),"mcOVER");
- }
- }
-
- private function DeselectButton(param1:MovieClip) : *
- {
- if(!param1.mEnabled)
- {
- return;
- }
- AddMouseEvents(param1);
- SetButtonVisual(param1,"mcOUT");
- }
- }
- }
-